//
//  DHHUDView.m
//  Dresshere
//
//  Created by ZhangPeng on 2017/12/28.
//  Copyright © 2017年 张朋. All rights reserved.
//

#import "DHHUDView.h"

@interface DHHUDView()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;

@end

@implementation DHHUDView

- (IBAction)closeAction:(id)sender {
    [self removeFromSuperview];
}

+ (DHHUDView *)shareHUDViewWithContentString:(NSString *)contentString{
    DHHUDView *view = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([DHHUDView class]) owner:self options:nil] objectAtIndex:0];
    [view setFrame:[UIScreen mainScreen].bounds];
    view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];
    view.infoLabel.text = contentString;
    [view bk_whenTapped:^{
        [view removeFromSuperview];
    }];
    return view;
}

+ (DHHUDView *)shareHUDViewWithContentString:(NSString *)contentString andTitleString:(NSString *)titleString{
    DHHUDView *view = [self shareHUDViewWithContentString:contentString];
    view.titleLabel.text = titleString;
    return view;
}

+ (void)showHUDViewWithContentString:(NSString *)contentString{
    [kKeyWindow addSubview:[self shareHUDViewWithContentString:contentString]];
}

+ (void)showHUDViewWithContentString:(NSString *)contentString andTitleString:(NSString *)titleString{
    [kKeyWindow addSubview:[self shareHUDViewWithContentString:contentString andTitleString:titleString]];
}

@end
